 <script>
            function openWindow(id){
            	var width = 480;
        		var height = 500;
        		
        		var top = parseInt((screen.availHeight/2) - (height/2));

        		var left = parseInt((screen.availWidth/2) - (width/2));

            	//var win =  window.open("win", ' width=500, height=600, top='+top+', left='+left);
            	//var win = window.open('contact.php',
    			//		"menubar=no,resizable=no,width=500,height=500,scrollbars=yes,left="  
    			//		+ left + ",top=" + top + ",screenX=" + left + ",screenY=" + top);    
                 var win = window.open("", "win", "width=500,height=500,top="+top+",left="+left);// a window object
               var myText = document.getElementById(id).innerHTML;
                win.document.open("text/html", "replace");
             win.document.write(myText);
             win.document.title = "Nội dung";
                win.document.close(); 
                
            }

</script>
<?php $data = $this->paginator;
    function loadgroupnamebyid($id){
          if($id == 0) return 'Không có';
          else{
          Zend_loader::loadClass('Admin_Models_GpageModel');
          $db = new Admin_Models_GpageModel();
          $result =  $db->loadgroupnamebyid($id);
          return $result[0]['name_group'];
          }
    }
    function loadusername($id){
        Zend_loader::loadClass('Wap_Models_FriendModel');
          $db = new Wap_models_FriendModel();
          $result =  $db->loaduserinfobyid($id);
          if(isset($result[0]['Username'])){
        	  return $result[0]['Username'];
          }
    }
    function loadactive($id){
        if($id == 1) return 'Active';
        else return 'Inactive';
    }
?>
<div style="text-decoration: none;font-size: 108%;color: #262626;font-weight: bold;outline: none;">Danh sách note</div><p></p>


<!-- 
<form class="form-search" name="search_sukien">
    <input type="text" placeholder="Tìm kiếm" class="input-medium search-query" name="search">
  <select name="field">
      <option value="UserID">Người Post</option>
      <option value="name_note">Tên sự kiện</option>
      <option value="content_note">Nội dung</option>
  </select>
  <select name="group_field">
     <?php // foreach($this->note_group_list as $group_item){ ?>
      <option value="<?php // echo $group_item['GroupNoteID']; ?>"><?php // echo $group_item['name_group'];?></option>
     <?php //}?>
  </select>
  <button type="submit" class="btn">Search</button>
</form> 
-->
<table style="text-align: center" class="table table-hover table-bordered">
    <tr>
        <th style="width:20px">STT</th>
        <th>Người post</th>
        <th>Name</th>
        <th>Thuộc nhóm</th>
        <th>Nội dung</th>
        <th>Active</th>
        <th style="width:60px">Thay đổi</th>
        <th style="width:20px">Xóa</th>
        
    </tr>
    <?php $i=1; foreach($data as $item){ ?>
    <tr>
        <td style="width:20px"><?php echo $item['idnote'] ?></td>
        <td><?php echo loadusername($item['UserID']);?></tD>
        <td><a href="/admin/gpage/edit-note?id=<?php echo $item['idnote'] ?>"><?php echo $item['name_note'];?></a></td>
        <td><?php echo loadgroupnamebyid($item['GroupNoteID']);?></td>  
         <td style="display: none;" id=feature.<?php echo $i;?> >
             <div style="width:480px;max-width: 480px">
                        <img style="width:480px" src="<?php echo $item['link_images']; ?>">
			<?php echo $item['content_note']; ?>
             </div>
        </td>	
              <td><span onclick="openWindow('feature.<?php echo $i;?>')">Xem nội dung</span></td>

        <td><?php echo loadactive($item['active']); ?></td>

        <td style="text-align: center"><a href="/admin/gpage/edit-note?id=<?php echo $item['idnote'] ?>"><i class="icon-pencil"></i></a></td>
        <td><a href="/admin/gpage/del-note?id=<?php echo$item['idnote'];?>"><i  onclick="return confirm('Are you sure?')" class="icon-trash"></i></a></td>
       	
    </tr>
    <?php $i++;} ?>
</table>
<?php  echo  $this->paginationControl($this->paginator, 'Sliding', 'gpage/pagination.phtml',$params=null); ?>
